package org.jspar.tile;

public class Position {

	private int x;
	private int y;

	public Position(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int x() {
		return x;
	}
	
	public int y() {
		return y;
	}
	
	public Position copy() {
		return new Position(x, y);
	}
	
	public Position add(Position p) {
		return new Position(x + p.x, y + p.y);
	}
	
	public Position mul(int amount) {
		return new Position(x * amount, y * amount);
	}
	
	public int manhatanDistance(Position p) {
		return Math.abs(x - p.x) + Math.abs(y - p.y);
	}
	
	public String toString() {
		return "(" + x + "," + y +")";
	}

}
